<?php
	set_include_path("/var/www/sportbook/classes" . PATH_SEPARATOR . get_include_path());
	require_once 'propel/Propel.php';
	Propel::init("/var/www/sportbook/conf/sportbook-conf.php");

	$isLogged = false;
	
	if (isset($_REQUEST[email]) && isset($_REQUEST[password])) 
	{
		$loginCriteria = new Criteria();
		$loginCriteria->add(MemberPeer::EMAIL, $_REQUEST[email]);
		$loginCriteria->add(MemberPeer::PASSWORD, $_REQUEST[password]);
		
		$member = MemberPeer::doSelectOne($loginCriteria);
		if ($member != null)
		{
			$isLogged = true;
			session_start();
			$_SESSION["id_member"] = $member->getIdMember();
		}
	}
	
	
	if ($isLogged) 
	{
		// redirect to user home page
	} else {
		// display login
		include("inc/login.inc.php");
	}
?>